//
//  FreshFoodFirstLevelCell.swift
//  SmartHousekeeper
//
//  Created by 刘森 on 2020/2/21.
//  Copyright © 2020 LS. All rights reserved.
//

import UIKit

class FreshFoodFirstLevelCell: UITableViewCell {
    lazy private var nameLabel: UILabel = {
        let value = UILabel(textColor: KColorRGBA(129, 129, 129), textFont: KFont(Adapter(16)))
        value.textAlignment = .center
        return value
    }()
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.contentView.addSubviews([nameLabel])
        self.backgroundColor = KColorRGBA(248, 245, 242)
        self.selectedBackgroundView =  UIView()
        self.selectedBackgroundView?.backgroundColor = KColorRGBA(235, 228, 219)

    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    override func layoutSubviews() {
        super.layoutSubviews()
        self.nameLabel.snp.makeConstraints { (make) in
            make.center.equalToSuperview()
        }
    }
    var name: String? {
        didSet {
            if let name = self.name {
                self.nameLabel.text = name
                nameLabel.lw_showRedDot(Int(arc4random() % 2))

            }
        }
    }
}
